package com.igeekhome.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.igeekhome.biz.ISessionService;
import com.igeekhome.pojo.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * <p>
 * 会话表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2021-03-16
 */
@Controller
@RequestMapping("/session")
public class SessionController {
    @Autowired
    private ISessionService iSessionService;

    @RequestMapping("/Session")
    public String aa(Model model, HttpSession s, Session se, Integer current, Integer size)
    {

       this.iSessionService.removeById(se);
//        session.setAttribute("list",iSessionService.list());//
        IPage<Session> page=new Page<>(current,size);
        IPage<Session> page1 = this.iSessionService.page(page);
        List<Session> list = page1.getRecords();
        long pagesCount = page1.getPages();
        s.setAttribute("list",list);
        s.setAttribute("pagesCount",pagesCount);
        s.setAttribute("current",current);
        s.setAttribute("size",size);
        return "Session";
    }



}

